package pl.pkolodziej.platform.dao.course;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;

import pl.pkolodziej.platform.vo.course.Course;

@Repository
public class CourseDAOImpl implements CourseDAO {

	@Autowired
	private SessionFactory sessionFactory;
	
	@Autowired
	HibernateTemplate hibernateTemplate;

	public void addCourse(Course course) {
		sessionFactory.getCurrentSession().save(course);
	}
	

	public List<Course> listCourses() {
		return sessionFactory.getCurrentSession().createQuery("from Course").list();
	}
	
}
